#include <iostream>

using namespace std;

class OS {
public:
    virtual void InstallOS_impl() = 0;
};

class LinuxOS : public OS {
public:
    virtual void InstallOS_impl() {
        cout << "Install Linux OS" << endl;
    };
};

class WindowsOS : public OS {
public:
    virtual void InstallOS_impl() {
        cout << "Install Windows OS" << endl;
    };
};

class UnixOS : public OS {
public:
    virtual void InstallOS_impl() {
        cout << "Install Unix OS" << endl;
    };
};

class Computer {
public:
    virtual void printInfo() = 0;
    virtual void InstallOS() = 0;
};

class Mac : public Computer {
private:
    OS *impl;
public:
    virtual void printInfo() {cout<<"This is a Mac, ";};
    Mac(OS *impl) { this->impl = impl;}
    void InstallOS() {
        printInfo();
        impl->InstallOS_impl();
    }
};

//class MacWithLinux : public Mac, public LinuxOS {
//public:
//    virtual void InstallOS() {
//        printInfo();
//        Install();
//    };
//};
//
//class MacWithWindows : public Mac, public WindowsOS {
//public:
//    virtual void InstallOS() {
//        printInfo();
//        Install();
//    };
//};

class Lenovo : public Computer {
private:
    OS *impl;
public:
    virtual void printInfo() {cout<<"This is a Lenovo, ";};
    Lenovo(OS *impl) { this->impl = impl;}
    void InstallOS() {
        printInfo();
        impl->InstallOS_impl();
    }
};

//class LenovoWithLinux : public Mac, public LinuxOS {
//public:
//    virtual void InstallOS() {
//        printInfo();
//        Install();
//    };
//};
//
//class LenovoWithWindows : public Mac, public WindowsOS {
//public:
//    virtual void InstallOS() {
//        printInfo();
//        Install();
//    };
//};

int main() {

    OS *os1 = new LinuxOS();
    OS *os2 = new WindowsOS();
    OS *os3 = new UnixOS();

    Computer *c1 = new Mac(os1);
    Computer *c2 = new Lenovo(os2);
    Computer *c3 = new Lenovo(os3);

    c1->InstallOS();
    c2->InstallOS();
    c3->InstallOS();

    return 0;
}
